<?php

namespace App\Tools;


class Redis
{

    private  static $instance = null;

    private function __construct(){}

    //静态方法，单例统一访问入口
    static public function getInstance() {
        if (self::$instance == null) {
            $redis = new \Redis();
            $redis->connect('127.0.0.1', 6379);
            $redis->select(5);
            self::$instance = $redis;
        }
        return self::$instance;
    }

}
